/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.msk.wlhy.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.msk.base.domain.goods.Goods;
import com.msk.common.utils.DictUtils;
import com.msk.sys.domain.DataEntity;
import com.msk.sys.domain.Office;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import java.util.List;

/**
 * <p>[]</p>
 * <p>作者：zkp</p>
 * <p>邮箱：zkp@xiangyou.com</p>
 * <p>创建时间： 2018-06-07 </p>
 * <p>类说明：物流订单Entity </p>
 * <p>修改记录：</p>
 */
public class HtLogisticsOrder extends DataEntity<HtLogisticsOrder> {
	
	private static final long serialVersionUID = 1L;
	private Office company;
	private Office office;
	private String orderNo;
	private String customer;
	private String goodsType;
	private String goodsName;
	private String status;
	private String attstr01;
	private String attstr02;
	private String attstr03;
	private String attstr04;
	
	private String attstr05;
	
	private Date attdate01;
	private Date attdate02;
	private String statusAlias;
	private String goodsTypeAlias;
	private String delFlagAlias;		// 转换后的del_flag
	private String customerName; //托运客户名称
	private List<HtLogisticsOrderDetail> htLogisticsOrderDetailList;
	public Long count;//数量
	private String consigner;
    private String consignerName;
	private String consignerNumber;
	private String consignee;
    private String consigneeName;
	private String consigneeNumber;
    private String uppicture;
    private String startAreaName;
	private String endAreaName;
	private String startArea;
	private String endArea;

	private Double allFreight;

	private Double allGoodWeight;

	private String itemsCounts;

	private String textRate; //税率
	private String rateMoney; //税额
	private String outRateMoney;//不含税金额

	private String revicePrice;//含税金额

	private String transportPrice;//合同单价

	private String  goodsCode;
	private String attstr05Alias;

	private Goods goods;//货源
	private String consignerUser;
	private String consignerUserTwo;
	private String consignerNumberTwo;
	private String consigneeUser;
	private String consigneeUserTwo;
	private String consigneeNumberTwo;

	private String platOwnerDocFile;//平台和货主合同-doc
	private String platOwnerPdfFile;//平台和货主合同-pdf

	private String publishWay;


	private Double goodsWeight;
	private Double realGoodsWeight;
	private Double remainingGoodsWeight;

	private String createByName;
	
	private String createDate1;

	//计价方式 1:吨/公里 2:整车';
	private String priceWay;
	private String priceWayAlias;
	//car_num需要整车数量
	private String carNum;

	/**
	 * 部分导出使用
	 */
	private String[] idArray;
	public String getConsignerUser() {
		return consignerUser;
	}

	public void setConsignerUser(String consignerUser) {
		this.consignerUser = consignerUser;
	}

	public String getConsignerUserTwo() {
		return consignerUserTwo;
	}

	public void setConsignerUserTwo(String consignerUserTwo) {
		this.consignerUserTwo = consignerUserTwo;
	}

	public String getConsignerNumberTwo() {
		return consignerNumberTwo;
	}

	public void setConsignerNumberTwo(String consignerNumberTwo) {
		this.consignerNumberTwo = consignerNumberTwo;
	}

	public String getConsigneeUser() {
		return consigneeUser;
	}

	public void setConsigneeUser(String consigneeUser) {
		this.consigneeUser = consigneeUser;
	}

	public String getConsigneeUserTwo() {
		return consigneeUserTwo;
	}

	public void setConsigneeUserTwo(String consigneeUserTwo) {
		this.consigneeUserTwo = consigneeUserTwo;
	}

	public String getConsigneeNumberTwo() {
		return consigneeNumberTwo;
	}

	public void setConsigneeNumberTwo(String consigneeNumberTwo) {
		this.consigneeNumberTwo = consigneeNumberTwo;
	}



	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	public String getTransportPrice() {
		return transportPrice;
	}

	public void setTransportPrice(String transportPrice) {
		this.transportPrice = transportPrice;
	}

	public String getTextRate() {
		return textRate;
	}

	public void setTextRate(String textRate) {
		this.textRate = textRate;
	}

	public String getRateMoney() {
		return rateMoney;
	}

	public void setRateMoney(String rateMoney) {
		this.rateMoney = rateMoney;
	}

	public String getOutRateMoney() {
		return outRateMoney;
	}

	public void setOutRateMoney(String outRateMoney) {
		this.outRateMoney = outRateMoney;
	}

	public String getRevicePrice() {
		return revicePrice;
	}

	public void setRevicePrice(String revicePrice) {
		this.revicePrice = revicePrice;
	}

	public void setAllFreight(Double allFreight) {
		this.allFreight = allFreight;
	}

	public void setAllGoodWeight(Double allGoodWeight) {
		this.allGoodWeight = allGoodWeight;
	}

	private String originalNumber;
	
	@Length(min=0, max=64, message="原始单号长度必须介于 0 和 64之间")
	public String getOriginalNumber() {
		return originalNumber;
	}

	public void setOriginalNumber(String originalNumber) {
		this.originalNumber = originalNumber;
	}

	public HtLogisticsOrder() {
		super();
	}

	public HtLogisticsOrder(String id){
		super(id);
	}

	public Office getCompany() {
		return company;
	}

	public void setCompany(Office company) {
		this.company = company;
	}
	
	public Office getOffice() {
		return office;
	}

	public void setOffice(Office office) {
		this.office = office;
	}
	
	@Length(min=0, max=100, message="物联订单号长度必须介于 0 和 100 之间")

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}
	
	@Length(min=0, max=100, message="托运客户长度必须介于 0 和 100 之间")
	public String getCustomer() {
		return customer;
	}

	public void setCustomer(String customer) {
		this.customer = customer;
	}
	
	@Length(min=0, max=10, message="货物类型长度必须介于 0 和 10 之间")
	public String getGoodsType() {
		return goodsType;
	}

	public void setGoodsType(String goodsType) {
		this.goodsType = goodsType;
	}
	
	@Length(min=0, max=100, message="货物名称长度必须介于 0 和 100 之间")
	public String getGoodsName() {
		return goodsName;
	}

	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}
	
	@Length(min=0, max=10, message="1未派车，2执行中，3已完成长度必须介于 0 和 10 之间")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	
	@Length(min=0, max=200, message="attstr01长度必须介于 0 和 200 之间")
	public String getAttstr01() {
		return attstr01;
	}

	public void setAttstr01(String attstr01) {
		this.attstr01 = attstr01;
	}
	
	@Length(min=0, max=200, message="attstr02长度必须介于 0 和 200 之间")
	public String getAttstr02() {
		return attstr02;
	}

	public void setAttstr02(String attstr02) {
		this.attstr02 = attstr02;
	}
	
	@Length(min=0, max=200, message="attstr03长度必须介于 0 和 200 之间")
	public String getAttstr03() {
		return attstr03;
	}

	public void setAttstr03(String attstr03) {
		this.attstr03 = attstr03;
	}
	
	@Length(min=0, max=200, message="attstr04长度必须介于 0 和 200 之间")
	public String getAttstr04() {
		return attstr04;
	}

	public void setAttstr04(String attstr04) {
		this.attstr04 = attstr04;
	}
	
	
	@Length(min=0, max=200, message="attstr05长度必须介于 0 和 200 之间")
	public String getAttstr05() {
		return attstr05;
	}

	public void setAttstr05(String attstr05) {
		this.attstr05 = attstr05;
	}
	
	
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getAttdate01() {
		return attdate01;
	}

	public void setAttdate01(Date attdate01) {
		this.attdate01 = attdate01;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getAttdate02() {
		return attdate02;
	}

	public void setAttdate02(Date attdate02) {
		this.attdate02 = attdate02;
	}
	
	
	
	public List<HtLogisticsOrderDetail> getHtLogisticsOrderDetailList() {
		return htLogisticsOrderDetailList;
	}

	
	public void setHtLogisticsOrderDetailList(List<HtLogisticsOrderDetail> htLogisticsOrderDetailList) {
		this.htLogisticsOrderDetailList = htLogisticsOrderDetailList;
	}

	
	public String getStatusAlias() {
		if(StringUtils.isBlank(statusAlias)){
			return DictUtils.getDictLabel(status, "ht_order_status", "");
		}
		return statusAlias;
	}

	
	public void setStatusAlias(String statusAlias) {
		this.statusAlias = statusAlias;
	}

	
	public String getGoodsTypeAlias() {
		if(StringUtils.isBlank(goodsTypeAlias)){
			return DictUtils.getDictLabel(goodsType, "goods_type", "");
		}
		return goodsType;
	}

	
	public void setGoodsTypeAlias(String goodsTypeAlias) {
		this.goodsTypeAlias = goodsTypeAlias;
	}

	public String getDelFlagAlias() {
		if(StringUtils.isBlank(delFlagAlias)){
			return DictUtils.getDictLabel(delFlag, "del_flag", "");
		}
		return delFlagAlias;
	}

	public void setDelFlagAlias(String delFlagAlias) {
		this.delFlagAlias = delFlagAlias;
	}
	
	
	public String getCustomerName() {
		return customerName;
	}

	
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
	
	public String getLogTitle() {
		return "物流订单";
	}
	
//	public String getLogType() {
//		return Log.LogType.module_operate.name();
//	}

	public Long getCount() {
		return count;
	}

	public void setCount(Long count) {
		this.count = count;
	}

	public String getConsigner() {
		return consigner;
	}

	public void setConsigner(String consigner) {
		this.consigner = consigner;
	}

	public String getConsignerName() {
		return consignerName;
	}

	public void setConsignerName(String consignerName) {
		this.consignerName = consignerName;
	}

	public String getConsignerNumber() {
		return consignerNumber;
	}

	public void setConsignerNumber(String consignerNumber) {
		this.consignerNumber = consignerNumber;
	}

	public String getConsignee() {
		return consignee;
	}

	public void setConsignee(String consignee) {
		this.consignee = consignee;
	}

	public String getConsigneeName() {
		return consigneeName;
	}

	public void setConsigneeName(String consigneeName) {
		this.consigneeName = consigneeName;
	}

	public String getConsigneeNumber() {
		return consigneeNumber;
	}

	public void setConsigneeNumber(String consigneeNumber) {
		this.consigneeNumber = consigneeNumber;
	}

	public String getUppicture() {
		return uppicture;
	}

	public void setUppicture(String uppicture) {
		this.uppicture = uppicture;
	}

	public String getStartAreaName() {
		return startAreaName;
	}

	public void setStartAreaName(String startAreaName) {
		this.startAreaName = startAreaName;
	}

	public String getEndAreaName() {
		return endAreaName;
	}

	public void setEndAreaName(String endAreaName) {
		this.endAreaName = endAreaName;
	}

	public Double getAllFreight() {
		return allFreight;
	}

	public void setAllFreight(double allFreight) {
		this.allFreight = allFreight;
	}

	public Double getAllGoodWeight() {
		return allGoodWeight;
	}

	public void setAllGoodWeight(double allGoodWeight) {
		this.allGoodWeight = allGoodWeight;
	}

	public String getStartArea() {
		return startArea;
	}

	public void setStartArea(String startArea) {
		this.startArea = startArea;
	}

	public String getEndArea() {
		return endArea;
	}

	public void setEndArea(String endArea) {
		this.endArea = endArea;
	}

	public String getItemsCounts() {
		return itemsCounts;
	}

	public void setItemsCounts(String itemsCounts) {
		this.itemsCounts = itemsCounts;
	}

	public String getGoodsCode() {
		return goodsCode;
	}

	public void setGoodsCode(String goodsCode) {
		this.goodsCode = goodsCode;
	}

	public String getAttstr05Alias() {
		if(StringUtils.isBlank(attstr05Alias)){
			return DictUtils.getDictLabel(attstr05, "unit_type", "");
		}
		return attstr05Alias;
	}

	
	public void setAttstr05Alias(String attstr05Alias) {
		this.attstr05Alias = attstr05Alias;
	}

	public String getPlatOwnerDocFile() {
		return platOwnerDocFile;
	}

	public void setPlatOwnerDocFile(String platOwnerDocFile) {
		this.platOwnerDocFile = platOwnerDocFile;
	}

	public String getPlatOwnerPdfFile() {
		return platOwnerPdfFile;
	}

	public void setPlatOwnerPdfFile(String platOwnerPdfFile) {
		this.platOwnerPdfFile = platOwnerPdfFile;
	}

	public Double getGoodsWeight() {
		return goodsWeight;
	}

	public void setGoodsWeight(Double goodsWeight) {
		this.goodsWeight = goodsWeight;
	}

	public Double getRealGoodsWeight() {
		return realGoodsWeight;
	}

	public void setRealGoodsWeight(Double realGoodsWeight) {
		this.realGoodsWeight = realGoodsWeight;
	}

	public Double getRemainingGoodsWeight() {
		if(goodsWeight != null &&realGoodsWeight != null&&goodsWeight != 0 && realGoodsWeight != 0){
			if (goodsWeight.compareTo(realGoodsWeight) < 0) {
				return Double.valueOf("0");
			}
			return goodsWeight - realGoodsWeight;
		}
		if(remainingGoodsWeight == null){
			return goodsWeight;
		}
		return remainingGoodsWeight;
	}

	public void setRemainingGoodsWeight(Double remainingGoodsWeight) {
		this.remainingGoodsWeight = remainingGoodsWeight;
	}

	public String getPublishWay() {
		if(goods != null && StringUtils.isNotBlank(goods.getPublishWay())){
			String publishWayStr = "";
			if("1".equalsIgnoreCase(goods.getPublishWay())){
				publishWayStr = "直接发布";
			}else if("2".equalsIgnoreCase(goods.getPublishWay())){
				publishWayStr = "定向发布";
			}else if("3".equalsIgnoreCase(goods.getPublishWay())){
				publishWayStr = "竞价发布";
			}
			return publishWayStr;
		}
		return publishWay;
	}

	public void setPublishWay(String publishWay) {
		this.publishWay = publishWay;
	}

	public String getCreateByName() {
		if(createBy != null && StringUtils.isNotBlank(createBy.getName())){
			return createBy.getName();
		}
		return createByName;
	}

	public void setCreateByName(String createByName) {
		this.createByName = createByName;
	}

	public String getCreateDate1() {
		return createDate1;
	}

	public void setCreateDate1(String createDate1) {
		this.createDate1 = createDate1;
	}

	public String[] getIdArray() {
		return idArray;
	}

	public void setIdArray(String[] idArray) {
		this.idArray = idArray;
	}

	public String getPriceWay() {
		return priceWay;
	}

	public void setPriceWay(String priceWay) {
		this.priceWay = priceWay;
	}

	public String getPriceWayAlias() {
		if (StringUtils.isNotBlank(priceWay)) {
			priceWayAlias = DictUtils.getDictLabel(priceWay, "price_way", "");
		}else{
			priceWayAlias = "吨公里";
		}
		return priceWayAlias;
	}

	public void setPriceWayAlias(String priceWayAlias) {
		this.priceWayAlias = priceWayAlias;
	}

	public String getCarNum() {
		return carNum;
	}

	public void setCarNum(String carNum) {
		this.carNum = carNum;
	}
}